package com.stud.dustteam.model;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: Asus
 * Date: 09.11.12
 * Time: 21:43
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "User")
public class User {

    private Set<OrderForSign> orderForSigns = new HashSet<OrderForSign>(0);
    private Integer id;
    private String name;
    private String phone;
    private String address;
    private String email;
    private String login;
    private String password;
    private Role role;

    @Id
    @GeneratedValue
    @Column(name = "user_id")
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "phone")
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Column(name = "address")
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Column(name = "email")
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Column(name = "login")
    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    @Column(name = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Enumerated(EnumType.STRING)
    @Column(name = "role")
    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
    public Set<OrderForSign> getOrderForSigns() {
        return orderForSigns;
    }

    public void setOrderForSigns(Set<OrderForSign> orderForSigns) {
        this.orderForSigns = orderForSigns;
    }
}